<!--
 * @Description: 居中
 * @Author: charles
 * @Date: 2021-08-12 14:11:49
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-08-19 09:52:45
-->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>盒子居中</title>
  <style>
    body {
      margin: 0;
    }
    .container {
      box-sizing: border-box;
      background-color: #ccc;
      height: 400px;
      padding: 50px;
      /* padding: 150px; */
    }
    .box {
      height: 100px;
      background-color: lightskyblue;
      width: 100px;
      margin-top: 100px;

      margin-left: auto;
      margin-right: auto;
      vertical-align: center;
      /* margin-left: 50%; */
      /* position: relative; */
      /* left: -50px; */
    }
  </style>
</head>
<body>
  <div class="container">
    <div class="box">box</div>
  </div>
</body>
</html>
